<?php
declare (strict_types=1);

namespace app\mall\validate\product\admin;

use think\Validate;

/**
 * 机构验证
 */
class Product extends Validate
{
    /**
     * 定义验证规则
     * 格式：'字段名'    =>    ['规则1','规则2'...]
     *
     * @var array
     */
    protected $rule = [
        'title'            => 'require',
        'cates'            => 'require',
        'cover'            => 'require|number|gt:0',
        'admin_user_phone' => 'require|mobile',
        'info'             => 'require',
        'cash_price'       => 'require|float',
        'credit_price'     => 'require|number',
        'stock_num'        => 'require|number',
        'is_recommend'     => 'require|in:0,1',
        'best_sort'        => 'require|number',
        'fictitious'       => 'require|in:0,1',
        'carriage'         => 'require|float',
        'status'           => 'require|in:0,1',
    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名'    =>    '错误信息'
     *
     * @var array
     */
    protected $message = [
    ];

    /**
     * 验证场景
     */
    protected $scene = [
        'create' => ['title', 'cates', 'cover', 'info', 'cash_price', 'credit_price', 'stock_num', 'fictitious', 'carriage'],//'is_recommend', 'best_sort', , 'status'
    ];

}
